//
//  NoTUploadSendVC.m
//  Inforcollection
//  Created by ocean on 16/10/26.
//  Copyright © 2016年 oceansoft.liw. All rights reserved.

#import "NoTUploadSendVC.h"
#import "NotAndUploadCell.h"
#import "UtilObject.h"
#import "ProgressView.h"
#import "NotUpdataTool.h"
#import "UtilObject.h"
#define ProgressCount 130
@interface NoTUploadSendVC ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView*NoTUploadTable;
    NSArray*NotUploadDate;
    NSMutableArray*NotImageDate;
    UIImage*img;
    NSDictionary*Dict;
    long ImageCount;
    CGFloat ProgressFloate;
    NSFileManager* fm;
//    NSArray *files;
    BOOL isSelected;
    NSString*ProgressText;
    AFHTTPRequestOperationManager * manager;
    NSMutableArray*BtntitleArray;
    UIView*noDataView;
}
@end

@implementation NoTUploadSendVC
   NSArray*files;
   BOOL isSelected;

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=[UIColor groupTableViewBackgroundColor];
    BtntitleArray=[NSMutableArray array];
    
    NotImageDate=[NSMutableArray array];
    
    [self setNaviBarTitle:@"未上传寄件单"];
    
    [self setNavBarColor:APPNavibackColor];
    
    NotUploadDate=[NotUpdataTool getUserDataforSanbox];

    NotImageDate=[NotUpdataTool getImageArrayforSanbox:0];
    
    [SharedNotifiCenter addObserver:self selector:@selector(RefreshControlerdata) name:UPloadFinish object:nil];
    [self setNoTiploadTableFrame];
    
}


-(void)setNoTiploadTableFrame{
    
    NoTUploadTable=[[UITableView alloc]initWithFrame:CGRectMake(0, APPNaviHeight, ScreenWidth, ScreenHeight-APPNaviHeight-45) style:UITableViewStyleGrouped];
    NoTUploadTable.delegate=self;
    NoTUploadTable.dataSource=self;
    [self.view addSubview:NoTUploadTable];
    [self.view addSubview:NoTUploadTable];
    if (NotImageDate.count==0) {
        noDataView = [UtilObject getNodataTipView];
        [NoTUploadTable addSubview:noDataView];
    }else{
        [noDataView removeFromSuperview];
    }
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  
    return NotImageDate.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 105;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{

    return 1;
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 1;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NotAndUploadCell*Cell=[[[NSBundle mainBundle]loadNibNamed:@"NotAndUploadCell" owner:nil options:nil] firstObject];
    Cell.IconImage.image=NotImageDate[indexPath.section];
    Dict=NotUploadDate[indexPath.section];
    Cell.NameLab.text=Dict[@"senderName"];
    Cell.TelpLable.text=Dict[@"senderPhone"];
    Cell.OrdNumLable.text=Dict[@"orderNo"];
    Cell.AdressLable.text=Dict[@"senderAddressAuto"];
    Cell.TimeLable.text=Dict[@"TimeStep"];
    Cell.StaticLab.text=@"未上传";
    return Cell;
}
-(BOOL)hidesBottomBarWhenPushed{

    return YES;
}

-(void)RefreshControlerdata{
    NotImageDate=[NotUpdataTool getImageArrayforSanbox:0];
    NotUploadDate=[NotUpdataTool getUserDataforSanbox];
    if (NotImageDate.count==0) {
        noDataView = [UtilObject getNodataTipView];
        [NoTUploadTable addSubview:noDataView];
    }else{
        [noDataView removeFromSuperview];
    }

    [NoTUploadTable reloadData];
}

@end
